package com.wanglibao.woodtrade.woodtrade.util;

/**
 * Created by lugg on 2016/5/24.
 */
public class DateUtils {

    public static String getTimeDifference(long pay_time){
        pay_time = pay_time * 1000;
        long nowTime = System.currentTimeMillis();
        pay_time = (nowTime - pay_time) / 1000 / 60;
        String StringDate = "";
        if (pay_time >= 518400){ //年
            StringDate = (pay_time / 518400)+"年前";
        }else if (pay_time >= 43200){ //月
            StringDate = (pay_time / 43200)+"个月前";
        }else if (pay_time >= 1440){ //天
            StringDate = (pay_time / 1440)+"天前";
        }else if (pay_time >= 60){//小时
            StringDate = (pay_time / 60)+"小时前";
        }else if (pay_time >= 1){
            StringDate = pay_time+"分钟前";
        }
        return StringDate;
    }
}
